﻿//Based on slantedLine Class from David Schwartz
package {
	
	import flash.display.Sprite;
	
	public class Bar extends Sprite 
	{		
		public var angle:Number;
		public var vx:Number = 0;
		public var vy:Number = 0;
		
		public function Bar(initX:Number, initY:Number, rot:Number) 
		{	
			init(initX, initY, rot);
		}
		
		public function init(initX:Number, initY:Number, rot:Number):void
		{
			
			graphics.clear();			
			graphics.lineStyle(1);
			graphics.beginFill(0xFF0000,1);				
			
			graphics.moveTo(0, -5);			
			graphics.lineTo(300, -5);
			graphics.lineTo(300, 5);
			graphics.lineTo(0, 5);
			graphics.lineTo(0, -5);			
			
			graphics.endFill();			
			
			//x = initX;
			//y = initY;
			
			rotation = rot;
			angle = rotation * Math.PI / 180;
		}
		
		public function drawBar(rot:Number):void
		{
			graphics.clear();			
			graphics.lineStyle(1);
			graphics.beginFill(0xFF0000,1);
			
			graphics.moveTo(0, -5);			
			graphics.lineTo(300, -5);
			graphics.lineTo(300, 5);
			graphics.lineTo(0, 5);
			graphics.lineTo(0, -5);		
			
			graphics.endFill();			
			
			rotation = rot;
			angle = rotation * Math.PI / 180;
		}		
	}
}